import axios from 'axios'
import { Message } from 'element-ui'

axios.defaults.baseURL = 'http://129.211.169.131:21003'
axios.defaults.timeout = 30000
// 响应拦截器
axios.interceptors.response.use(res => {
    if (res.data.code === 1) {
        Message.success(res.data.msg)

    } else if (res.data.code === 0) {
        Message.success(res.data.msg)
    }else if(res.data.code===0){
        Message.error(res.data.msg)
    }
    return res
}, err => {
    console.log(err);
})
// 请求拦截器
axios.interceptors.request.use(config => {
    // let token = localStorage.token
    // if (token) {
    //     config.headers.Authorization = token
    // }
    return config
}, err => {
    console.log(err);
})
export default axios